json-rpc over websocket in Rust
json-rpc
Rust JSON-RPC implementation
https://github.com/paritytech/jsonrpc
Rust implementation of JSON-RPC 2.0 Specification. Transport-agnostic core and transport servers for http, ipc, websockets and tcp.
Strongly typed JSON library for Rust
https://github.com/serde-rs/json
json macro
code:json.rs
use serde_json::json;
fn main() {
// The type of john is serde_json::Value
let john = json!({
"name": "John Doe",
"age": 43,
"phones": [
"+44 1234567",
"+44 2345678"
]
});
println!("first phone number: {}", john"phones"0);
// Convert to a string of JSON and print it out
println!("{}", john.to_string());
}
websocket
A WebSocket (RFC6455) library written in Rust
https://github.com/websockets-rs/rust-websocket
Lightweight, event-driven WebSockets for Rust.
https://github.com/housleyjk/ws-rs